package com.pjs.tdd;

import java.util.Calendar;
import java.util.Date;

public class SimpleTransactionReference implements TransactionReference {
	
	private ReferenceGenerator referenceGenerator;
	private Date date;
	private String id;

	public static TransactionReference transactionReference(){
		return new SimpleTransactionReference();
	}

	public SimpleTransactionReference() {
		super();
	}
	
	public void build(){
		date=Calendar.getInstance().getTime();
		id=referenceGenerator.nextReference();
	}

	@Override
	public Date date() {
		return this.date;
	}

	@Override
	public String id() {
		return id;
	}
	
	@Override
	public void setReferenceGenerator(final ReferenceGenerator referenceGenerator) {
		this.referenceGenerator = referenceGenerator;
	}
	
}
